import crypto from "crypto";

export const createRandomNumber = (length: number, data?: string) => {
	return Number(
		parseInt((data ? crypto.createHash("sha256").update(data).digest("hex") : crypto.randomBytes(Math.ceil(length * 0.5)).toString("hex")).substring(0, Math.ceil(length * 1.5)), 16)
			.toString()
			.substring(0, length)
	);
};
